package com.example.x6.configurationmaintenance.Module;

import android.os.Build;
import com.example.x6.configurationmaintenance.Common.BuildModel;
import com.example.x6.configurationmaintenance.Interface.OnRotateChangedListener;
import com.example.x6.configurationmaintenance.Utils.SystemBuildProp;

public class RotateManager {
    private OnRotateChangedListener onRotateChangedListener;
    private String rotateKey;
    private SystemBuildProp systemBuildProp = SystemBuildProp.getSystemBuildProp();

    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    public RotateManager() {
        char c;
        String str = Build.MODEL;
        switch (str.hashCode()) {
            case -1166686952:
                if (str.equals(BuildModel.RK3288)) {
                    c = 0;
                    break;
                }
                c = 65535;
                break;
            case -930858152:
                if (str.equals(BuildModel.RK3288_AND71)) {
                    c = 1;
                    break;
                }
                c = 65535;
                break;
            case 705928468:
                if (str.equals(BuildModel.A33)) {
                    c = 3;
                    break;
                }
                c = 65535;
                break;
            case 1348394193:
                if (str.equals(BuildModel.SC20)) {
                    c = 5;
                    break;
                }
                c = 65535;
                break;
            case 1636165901:
                if (str.equals(BuildModel.RK3399)) {
                    c = 2;
                    break;
                }
                c = 65535;
                break;
            case 1837070814:
                if (str.equals(BuildModel.H3)) {
                    c = 4;
                    break;
                }
                c = 65535;
                break;
            default:
                c = 65535;
                break;
        }
        switch (c) {
            case 0:
            case 1:
                this.rotateKey = "ro.sf.hwrotation";
                return;
            case 2:
                this.rotateKey = "ro.sf.hwrotation";
                return;
            case 3:
                this.rotateKey = "ro.sf.rotation";
                return;
            case 4:
                this.rotateKey = "ro.sf.dir";
                return;
            case 5:
                this.rotateKey = "persist.panel.orientation";
                return;
            default:
                return;
        }
    }

    public String getRotate() {
        return this.systemBuildProp.getProp(this.rotateKey);
    }

    public void setOnRotateChangedListener(OnRotateChangedListener onRotateChangedListener2, String value) {
        this.onRotateChangedListener = onRotateChangedListener2;
        startChange(value);
    }

    private void startChange(String value) {
        this.onRotateChangedListener.rotateChanged(this.systemBuildProp.setProp(this.rotateKey, value));
    }
}
